Skip to content

[๐Ÿš€ ์‚ฌ์ดํด2 - ๋ฏธ์…˜ (๋ธ”๋ž™์žญ ๋ฒ ํŒ…)] ๋งฅ์Šค ๋ฏธ์…˜ ์ œ์ถœํ•ฉ๋‹ˆ๋‹ค. #1130

Open
simhokyung wants to merge 87 commits intowoowacourse:simhokyungfrom
simhokyung:step2

Conversation

@simhokyung
Copy link

PR์„ main์œผ๋กœ ์ž˜๋ชป ๋‚ ๋ ค์„œ, ๊ธฐ์กด PR์„ ๋‹ซ๊ณ  ๋‹ค์‹œ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค! ๐Ÿ˜ญ

์ฒดํฌ ๋ฆฌ์ŠคํŠธ

  • ๋ฏธ์…˜์˜ ํ•„์ˆ˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋ชจ๋‘ ๊ตฌํ˜„ํ–ˆ๋‚˜์š”?
  • Gradle test๋ฅผ ์‹คํ–‰ํ–ˆ์„ ๋•Œ, ๋ชจ๋“  ํ…Œ์ŠคํŠธ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ํ†ต๊ณผํ–ˆ๋‚˜์š”?
  • ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰๋˜๋‚˜์š”?

์–ด๋–ค ๋ถ€๋ถ„์— ์ง‘์ค‘ํ•˜์—ฌ ๋ฆฌ๋ทฐํ•ด์•ผ ํ• ๊นŒ์š”?

1. ๊ธฐ์กด BlackjackGame.start() ๊ตฌ์กฐ๋ฅผ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์ƒ์„ฑ ์ •๋ณด ๊ฐ์ฒด๋ฅผ ์ถ”๊ฐ€ํ•œ ์„ ํƒ์ด ์ ์ ˆํ•œ๊ฐ€?

๊ธฐ์กด ๊ตฌ์กฐ์—์„œ๋Š” BlackjackGame.start()์— ํ”Œ๋ ˆ์ด์–ด ์ด๋ฆ„ ๋ชฉ๋ก(List<String>)์„ ์ „๋‹ฌํ•˜๊ณ ,
BlackjackGame ๋‚ด๋ถ€์—์„œ ์ด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ Player๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„๋˜์–ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

์ด๋ฒˆ ์‚ฌ์ดํด์—์„œ ๋ฒ ํŒ… ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜๋ฉด์„œ, ๋” ์ด์ƒ ์ด๋ฆ„๋งŒ์œผ๋กœ๋Š” Player๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๊ฒŒ ๋˜์—ˆ๊ณ ,
์ด๋ฆ„๊ณผ ํ•จ๊ป˜ BettingMoney๋„ ์ดˆ๊ธฐํ™”ํ•ด์•ผ ํ•˜๋Š” ์ƒํ™ฉ์ด ์ƒ๊ฒผ์Šต๋‹ˆ๋‹ค.

์ด๋•Œ ๊ฐ€์žฅ ๋จผ์ € ๊ณ ๋ฏผํ–ˆ๋˜ ๋ถ€๋ถ„์€, ๊ธฐ์กด์˜ ๊ตฌ์กฐ๋ฅผ ์ตœ๋Œ€ํ•œ ์œ ์ง€ํ•˜๋ฉด์„œ ํ™•์žฅํ•˜์ž๋Š” ๊ฒƒ์ด์—ˆ์Šต๋‹ˆ๋‹ค.
๊ธฐ์กด์ฒ˜๋Ÿผ BlackjackGame.start()๊ฐ€ ๊ฒŒ์ž„ ์‹œ์ž‘๊ณผ ํ”Œ๋ ˆ์ด์–ด ์ƒ์„ฑ์„ ํ•จ๊ป˜ ๋‹ด๋‹นํ•˜๋Š” ๊ตฌ์กฐ๋ฅผ ์œ ์ง€ํ•˜๋„๋ก ์„ค๊ณ„ํ•˜๊ณ  ์‹ถ์—ˆ๊ณ ,
๊ทธ๋ž˜์„œ start()์˜ ์—ญํ• ์€ ์œ ์ง€ํ•˜๋˜, ๋‹จ์ˆœ ์ด๋ฆ„ ๋ชฉ๋ก ๋Œ€์‹  ์ด๋ฆ„๊ณผ ๋ฐฐํŒ… ๊ธˆ์•ก์„ ํ•จ๊ป˜ ๋‹ด๋Š” PlayerCreationInfo ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค๊ณ , ๊ทธ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋„˜๊ฒจ์ฃผ๋Š” ๋ฐฉ์‹์„ ์„ ํƒํ–ˆ์Šต๋‹ˆ๋‹ค.

์ด ๋ฐฉ์‹์€ BlackjackGame.start() ๊ฐ€ ์—ฌ์ „ํžˆ ๊ฒŒ์ž„ ์ƒ์„ฑ ์ฑ…์ž„์„ ๊ฐ€์ง€๋„๋ก ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๊ณ ,
GameController๊ฐ€ ๋„๋ฉ”์ธ ๊ฐ์ฒด ์ƒ์„ฑ์— ๊นŠ๊ฒŒ ๊ด€์—ฌํ•˜์ง€ ์•Š๋„๋ก ํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์ ์—์„œ ๊ดœ์ฐฎ๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ PlayerCreationInfo๋Š” ์‹ค์ œ ๊ฒŒ์ž„ ์ง„ํ–‰ ์ค‘์—๋Š” ์‚ฌ์šฉ๋˜์ง€ ์•Š๊ณ  ์ƒ์„ฑ ์‹œ์ ์—๋งŒ ์‚ฌ์šฉ๋˜๊ธฐ ๋•Œ๋ฌธ์—,
์ด ๊ฐ์ฒด๊ฐ€ ๋„๋ฉ”์ธ์ ์œผ๋กœ ์˜๋ฏธ๊ฐ€ ์žˆ๋Š” ๊ฐ์ฒด์ธ์ง€,
์•„๋‹ˆ๋ฉด ๊ธฐ์กด ๊ตฌ์กฐ๋ฅผ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ๋งŒ๋“  ๋‹จ์ˆœ ํฌ์žฅ ๊ฐ์ฒด์— ๊ฐ€๊นŒ์šด์ง€์— ๋Œ€ํ•ด ๊ณ ๋ฏผ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

ํ˜„์žฌ ๋ฐฉ์‹์ด ์ ์ ˆํ•œ ์„ ํƒ์ธ์ง€,
ํ˜น์€ ํ”Œ๋ ˆ์ด์–ด ์ƒ์„ฑ ์ฑ…์ž„์„ ๋‹ค๋ฅธ ๊ฐ์ฒด๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ๋” ์ž์—ฐ์Šค๋Ÿฌ์šด์ง€
์ œ์ด๋ฏธ์˜ ์˜๊ฒฌ์„ ๋“ฃ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

2. Hand์˜ ์ฑ…์ž„ ๋ถ„๋ฆฌ

  1. Score๊ฐ€ Hand๋ฅผ ๋งŒ๋“ค๊ธฐ
  2. Hand๊ฐ€ Score๋ฅผ ๋งŒ๋“ค๊ธฐ
  3. ์ œ 3์ž๊ฐ€ Score๋ฅผ ๋งŒ๋“ค๊ธฐ
    ์ด๋ ‡๊ฒŒ ์ ์—ˆ์–ด์•ผ ํ–ˆ๋Š”๋ฐ ์˜คํƒ€๊ฐ€ ๋‚ฌ๋„ค์š”.
    ์ œ 3์ž๊ฐ€ Score๋ฅผ ๋งŒ๋“ค๊ณ  ์žˆ์ง€๋งŒ ๊ฒฐ๊ตญ ์ƒ์„ฑ์— ๋Œ€ํ•œ ํ–‰์œ„๋Š” Hand๊ฐ€ ํ•˜๊ณ  ์žˆ๋Š” ์ƒํ™ฉ์ธ๋ฐ์š”.
    ๋ญ”๊ฐ€, 3๋ฒˆ์„ ์˜๋„ํ–ˆ์ง€๋งŒ ์–ด๋А์ •๋„ 2๋ฒˆ์— ๊ฑธ์ณ์žˆ๋Š” ๊ฒƒ ๊ฐ™์•„ ์ฑ…์ž„ ๋ถ„๋ฆฌ๊ฐ€ ๋œ ๋˜์–ด๋ณด์ด๊ธฐ๋„ ํ•˜๋Š”๋ฐ, ์˜๋„๋œ ๋ถ€๋ถ„์ธ์ง€ ๊ถ๊ธˆํ–ˆ์–ด์š”.
    public Score getScore() {
        return new Score(ScoreCalculator.calculate(List.copyOf(cards)));
    }

Score๋ฅผ Hand์˜ ์ƒํƒœ๋กœ ๋ณด๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฝ๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ Hand.getScore()๋ฅผ ๋‘์—ˆ๊ณ , ๋‹ค๋งŒ ์ ์ˆ˜ ๊ณ„์‚ฐ ๊ทœ์น™๊นŒ์ง€ Hand๊ฐ€ ๋ชจ๋‘ ์•Œ ํ•„์š”๋Š” ์—†๋‹ค๊ณ  ํŒ๋‹จํ•ด ๊ณ„์‚ฐ ๊ณผ์ •์€ ScoreCalculator์— ์œ„์ž„ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ํ˜„์žฌ๋Š” Hand๊ฐ€ ๊ณ„์‚ฐ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ›์•„ Score๋ฅผ ์ƒ์„ฑํ•ด ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋‘์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ ๋ฆฌ๋ทฐ ์ฃผ์‹  ๋‚ด์šฉ์„ ๋ณด๋ฉด์„œ, ์ด ๊ตฌ์กฐ๊ฐ€ ์™„์ „ํžˆ โ€œ์ œ3์ž๊ฐ€ Score๋ฅผ ๋งŒ๋“ ๋‹คโ€๊ธฐ๋ณด๋‹ค๋Š” Hand๊ฐ€ ์ƒ์„ฑ ์ฑ…์ž„๊นŒ์ง€ ์ผ๋ถ€ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์„œ 2๋ฒˆ๊ณผ 3๋ฒˆ ์‚ฌ์ด์— ๊ฑธ์ณ ์žˆ๋Š” ํ˜•ํƒœ๋กœ๋„ ๋ณด์ผ ์ˆ˜ ์žˆ๊ฒ ๋‹ค๊ณ  ๋А๊ผˆ์Šต๋‹ˆ๋‹ค.

์—ฌ๊ธฐ์„œ ๊ถ๊ธˆํ•œ ๋ถ€๋ถ„์ด ์žˆ๋Š”๋ฐ์š”,
ScoreCalculator๊ฐ€ int๋งŒ ๊ณ„์‚ฐํ•˜๊ณ  Hand๊ฐ€ Score๋ฅผ ์ƒ์„ฑํ•˜๋Š” ํ˜„์žฌ ๊ตฌ์กฐ์™€, ScoreCalculator๊ฐ€ Score๊นŒ์ง€ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ตฌ์กฐ์˜ ํ•ต์‹ฌ ์ฐจ์ด๋ฅผ ์–ด๋–ป๊ฒŒ ๋ณด์‹œ๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
Score์˜ ์ƒ์„ฑ ์œ„์น˜๊ฐ€ ๋‹ค๋ฅด๊ธด ํ•˜์ง€๋งŒ, ์‚ฌ์šฉํ•˜๋Š” ์ชฝ์—์„œ๋Š” ๊ฒฐ๊ตญ Hand.getScore()๋กœ ๊ฐ€์ ธ๋‹ค ์“ฐ๊ฒŒ ๋˜์–ด์„œ, ์ œ๊ฐ€ ๋А๋ผ๊ธฐ์—” ๋น„์Šทํ•œ ๋ฐฉ์‹์ด๋ผ๊ณ  ์ƒ๊ฐ๋˜๋Š”๋ฐ, ์ •๋‹ต์ด ์žˆ๋Š”๊ฑธ๊นŒ์š”? ์ œ์ด๋ฏธ์˜ ์˜๊ฒฌ์ด ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

์ด์™ธ์—๋„ ๋ถ€์กฑํ•œ ๋ถ€๋ถ„์€ ์ž์œ ๋กญ๊ฒŒ ํ”ผ๋“œ๋ฐฑ ์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!

simhokyung and others added 30 commits March 5, 2026 12:52
- ๋”œ๋Ÿฌ ์นด๋“œ 16์ดํ•˜ ์—ฌ๋ถ€ ํ™•์ธ ํ…Œ์ŠคํŠธ ๊ตฌํ˜„
- ์นด๋“œ ์ถ”๊ฐ€ ํ™•์ธ ํ…Œ์ŠคํŠธ ๊ตฌํ˜„
- ํ”Œ๋ ˆ์ด์–ด์˜ ์นด๋“œ ์ถ”๊ฐ€ ์—ฌ๋ถ€ ํ™•์ธ ํ…Œ์ŠคํŠธ
- ํ”Œ๋ ˆ์ด์–ด์˜ ๋ฒ„์ŠคํŠธ ์—ฌ๋ถ€ ํ™•์ธ ํ…Œ์ŠคํŠธ
- ๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด๋“ค์˜ ๋ฒ„์ŠคํŠธ ์—ฌ๋ถ€ ํ™•์ธ ํ…Œ์ŠคํŠธ ์ž‘์„ฑ
- ํ”Œ๋ ˆ์ด์–ด ์ด๋ฆ„ ๊ธธ์ด๊ฐ€ 20์ž๋ฅผ ์ดˆ๊ณผํ•  ๊ฒฝ์šฐ ์˜ˆ์™ธ ๋ฐœ์ƒ ํ…Œ์ŠคํŠธ ์ž‘์„ฑ
- Null ํ˜น์€ ๋นˆ ๊ฐ’ ์ž…๋ ฅ ์‹œ ์˜ˆ์™ธ ๋ฐœ์ƒ ํ…Œ์ŠคํŠธ
- drawํ•˜๋Š” ๊ฒฝ์šฐ ํ…Œ์ŠคํŠธ ์ถ”๊ฐ€
-  DTO ์ƒ์„ฑ ๋‹จ๊ณ„์—์„œ ๊ณต๊ฐœํ•  ์นด๋“œ ๋ฒ”์œ„๋ฅผ ๊ฒฐ์ •ํ•˜๊ณ , ๋ทฐ๋Š” ์ „๋‹ฌ๋ฐ›์€ ๊ฐ’๋งŒ ์ถœ๋ ฅํ•˜๋„๋ก ํ•˜๋„๋ก ์ˆ˜์ •
- Hand์— hasScoreLessThanOrEqual ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ Dealer์˜ checkThreshold ๋ฉ”์„œ๋“œ์˜ ๋ฐ˜ํ™˜๊ฐ’์—์„œ์˜ ์ง„์ž…๊ฐœ์ˆ˜๋ฅผ ์ค„์ž„
- ๋ธ”๋ž™์žญ ํŒ๋‹จ ํ…Œ์ŠคํŠธ
- PlayerCreationInfo ํด๋ž˜์Šค๋ฅผ ํ™œ์šฉํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝ
- PlayerCreationInfo ํด๋ž˜์Šค๋ฅผ ํ™œ์šฉํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝ
- Player: ์ƒ์„ฑ์ž๋ถ€๋ถ„์— BettingMoney ์ถ”๊ฐ€
- Participant: getHand()๋ฉ”์„œ๋“œ ์ ‘๊ทผ์ œ์–ด์ž ๋ณ€๊ฒฝ(public -> protected๋กœ ๋ณ€๊ฒฝ)
- BlackjackGame.start()์˜ ์ธ์ž๋ฅผ ํ”Œ๋ ˆ์ด์–ด ์ด๋ฆ„๊ณผ ๋ฐฐํŒ…๊ธˆ์•ก์„ ํฌํ•จํ•˜๊ณ  ์žˆ๋Š” PlayerCreationInfo๋ฅผ ํ™œ์šฉํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝ
Copy link

@jamie9504 jamie9504 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•ˆ๋…•ํ•˜์„ธ์š”, ๋งฅ์Šค. ๋ฆฌ๋ทฐ์–ด ์ œ์ด๋ฏธ์ž…๋‹ˆ๋‹ค.

์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋‘์—ˆ์Šต๋‹ˆ๋‹ค.

@@ -1,34 +1,69 @@
package controller;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. ๊ธฐ์กด BlackjackGame.start() ๊ตฌ์กฐ๋ฅผ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์ƒ์„ฑ ์ •๋ณด ๊ฐ์ฒด๋ฅผ ์ถ”๊ฐ€ํ•œ ์„ ํƒ์ด ์ ์ ˆํ•œ๊ฐ€?

    ์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ PlayerCreationInfo๋ฅผ ์ง์ ‘ ๋งŒ๋“œ๋Š” ๊ฒƒ ์ž์ฒด๋„ ์ƒ์„ฑ์— ๊ด€์—ฌํ•˜๋Š” ํ–‰์œ„ ์•„๋‹๊นŒ์š”?
    ์•„๋ž˜ ** ์ฝ”๋ฉ˜ํŠธ๋„ ํ•จ๊ป˜ ํ™•์ธํ•ด๋ณด์„ธ์š”.

  2. Hand์˜ ์ฑ…์ž„ ๋ถ„๋ฆฌ

    ์ •๋‹ต์ด ์žˆ๋‹ค๊ธฐ๋ณด๋‹ค๋Š” ํŠธ๋ ˆ์ด๋“œ์˜คํ”„์˜ ๋ฌธ์ œ์˜ˆ์š”.

    ์‚ฌ์šฉํ•˜๋Š” ์ชฝ์—์„œ Hand.getScore()๋กœ ์“ฐ๋Š” ๊ฑด ๋™์ผํ•˜์ง€๋งŒ,
    Score๊ฐ€ isBust() ๊ฐ™์€ ํ–‰์œ„๋ฅผ ๊ฐ€์ง„๋‹ค๋ฉด ๋ˆ„๊ฐ€ ์ƒ์„ฑ ์ฑ…์ž„์„ ๊ฐ–๋Š”์ง€๊ฐ€ ์˜๋ฏธ ์žˆ์–ด์ ธ์š”.
    ํ˜„์žฌ ๊ตฌ์กฐ์—์„œ Hand๊ฐ€ new Score(...)๋ฅผ ์ง์ ‘ ํ˜ธ์ถœํ•˜๊ณ  ์žˆ์œผ๋‹ˆ,
    ScoreCalculator์— ์œ„์ž„ํ–ˆ๋‹ค๊ณ  ํ•ด๋„ ์ƒ์„ฑ ์ฑ…์ž„์€ Hand์— ๋‚จ์•„์žˆ๋Š” ์…ˆ์ด์—์š”.

    ๊ฒฐ๊ตญ ๋ˆ„๊ฐ€ ์ƒ์„ฑ ์ฑ…์ž„์„ ๊ฐ–๋Š”์ง€์˜ ์ฐจ์ด์˜ˆ์š”.

Comment on lines +98 to +104
List<String> playerProfitResults = players.getPlayers().stream()
.map(player -> String.format("%s: %s%n",
player.getNameValue(),
ProfitCalculator.formatProfit(
ProfitCalculator.calculatePlayerProfit(player, dealer)
)))
.toList();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ปจํŠธ๋กค๋Ÿฌ์—์„œ String.format์œผ๋กœ ์ง์ ‘ ํฌ๋งทํŒ…ํ•˜๊ณ  ์žˆ์–ด์š”.
์ถœ๋ ฅ ํ˜•์‹์— ๋Œ€ํ•œ ์ฑ…์ž„์€ OutputView๊ฐ€ ๊ฐ€์ง€๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฝ์ง€ ์•Š์„๊นŒ์š”?

List<PlayerCreationInfo> playerCreationInfos = new ArrayList<>();
for (String name : names) {
Integer money = InputView.readBettingMoney(name);
System.out.println();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.out.println()์ด ์ปจํŠธ๋กค๋Ÿฌ์— ์ง์ ‘ ์žˆ๋„ค์š”.
์ถœ๋ ฅ์€ OutputView์— ์œ„์ž„ํ•˜๋Š” ๊ฒƒ์ด ์–ด๋–จ๊นŒ์š”?

Comment on lines +24 to +25
System.out.printf("%s์˜ ๋ฐฐํŒ… ๊ธˆ์•ก์€?%n",name);
return Integer.parseInt(scanner.nextLine());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ˆซ์ž๊ฐ€ ์•„๋‹Œ ๊ฐ’์ด ์ž…๋ ฅ๋˜๋ฉด ์–ด๋–ป๊ฒŒ ๋˜๋‚˜์š”?

public class ProfitCalculator {
private static final double BLACKJACK_PROFIT_RATE = 1.5;

public static double calculatePlayerProfit(Player player, Dealer dealer) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ•จ์ˆ˜(๋˜๋Š” ๋ฉ”์„œ๋“œ)์˜ ๊ธธ์ด๊ฐ€ 10๋ผ์ธ์„ ๋„˜์–ด๊ฐ€์ง€ ์•Š๋„๋ก ๊ตฌํ˜„ํ•œ๋‹ค.

Comment on lines +9 to +24
public class BettingMoneyTest {

@Test
void ๋ฒ ํŒ…๊ธˆ์•ก์„_์ƒ์„ฑํ• _์ˆ˜_์žˆ๋‹ค(){
BettingMoney bettingMoney = BettingMoney.of(1000);
assertThat(bettingMoney.getMoney()).isEqualTo(1000);
}

@Test
void ๋ฒ ํŒ…๊ธˆ์•ก์ด_0์ดํ•˜๋ฉด_์˜ˆ์™ธ๊ฐ€_๋ฐœ์ƒํ•œ๋‹ค(){
assertThatThrownBy(() -> BettingMoney.of(0))
.isInstanceOf(IllegalArgumentException.class);
assertThatThrownBy(() -> BettingMoney.of(-1000))
.isInstanceOf(IllegalArgumentException.class);
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋งŒ์•ฝ product code์—์„œ ํ•ด๋‹น ๊ธฐ์ค€์ด 100 ์ดํ•˜๋ฉด ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค๋กœ ๋ณ€๊ฒฝ๋œ๋‹ค๋ฉด,
์ด ํ…Œ์ŠคํŠธ๋“ค๋กœ ๋ฌด์—‡์„ ์ ๊ฒ€ํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

Comment on lines +66 to +67
System.out.println("\n\n## ์ตœ์ข… ์ˆ˜์ต");
System.out.printf("๋”œ๋Ÿฌ: %s%n", dealerProfit);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฐœํ–‰๋ฌธ์ž๊ฐ€ ํ˜ผ์šฉ๋˜๊ณ  ์žˆ๋„ค์š”.
๊ฐ ๊ฐœํ–‰๋ฌธ์ž๋ณ„ ํŠน์ง•์„ ์ ์–ด์ฃผ์„ธ์š”.

Comment on lines 19 to 33
Player bustPlayer = Player.of(Name.from("pobi"), new Hand(new ArrayList<>(List.of(
Card.of(CardNumber.J, CardShape.CLOVER),
Card.of(CardNumber.K, CardShape.HEART),
Card.of(CardNumber.Q, CardShape.DIAMOND)))));
Card.of(CardNumber.J, CardShape.CLOVER),
Card.of(CardNumber.K, CardShape.HEART),
Card.of(CardNumber.Q, CardShape.DIAMOND))))
, BettingMoney.of(1000)
);

Player normalPlayer = Player.of(Name.from("jason"), new Hand(new ArrayList<>(List.of(
Card.of(CardNumber.J, CardShape.CLOVER),
Card.of(CardNumber.Q, CardShape.DIAMOND)))));
Card.of(CardNumber.Q, CardShape.DIAMOND)))),
BettingMoney.of(2000));

Players allBustPlayers = Players.from(List.of(bustPlayer, bustPlayer, bustPlayer));
Players containBustPlayers = Players.from(List.of(bustPlayer, normalPlayer, normalPlayer));
Players allNormalPlayers = Players.from(List.of(normalPlayer, normalPlayer, normalPlayer));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bustPlayer, normalPlayer ๋“ฑ์ด ํด๋ž˜์Šค ํ•„๋“œ๋กœ ์„ ์–ธ๋˜์–ด ์žˆ๋„ค์š”.

@BeforeEach ๋“ฑ์—์„œ ์„ ์–ธํ•˜๋Š” ๊ฒƒ๊ณผ ์–ด๋– ํ•œ ์ฐจ์ด๊ฐ€ ์žˆ์„๊นŒ์š”?


import static org.assertj.core.api.Assertions.assertThat;

public class ProfitCalculatorTest {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋”œ๋Ÿฌ์™€ ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๋ชจ๋‘ ๋ฒ„์ŠคํŠธ์ธ ๊ฒฝ์šฐ๋Š” ์—†์–ด๋„ ๋ ๊นŒ์š”?

package domain.card;

public enum CardNumber {
ACE("A", 1),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ทธ๋Ÿฌ๊ณ ๋ณด๋‹ˆ ACE๋Š” ํ’€๋„ค์ž„์œผ๋กœ, J, Q, K๋Š” ์•ฝ์–ด๋กœ ์„ ์–ธํ•œ ์ด์œ ๊ฐ€ ๋ฌด์—‡์ธ๊ฐ€์š”?
์ผ๊ด€์„ฑ ์žˆ๊ฒŒ ํ†ต์ผํ•œ๋‹ค๋ฉด ์–ด๋–ค ๊ธฐ์ค€์œผ๋กœ ๋งž์ถ”๋Š” ๊ฒŒ ์ข‹์„๊นŒ์š”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants